Skip to content

feat(openclaw): enhance example with configuration options#413

Open
Jah-yee wants to merge 2 commits intoalibaba:mainfrom
Jah-yee:main
Open

feat(openclaw): enhance example with configuration options#413
Jah-yee wants to merge 2 commits intoalibaba:mainfrom
Jah-yee:main

Conversation

@Jah-yee
Copy link

@Jah-yee Jah-yee commented Mar 10, 2026

Summary

Enhance the OpenClaw example with better configuration options and documentation:

Changes

  • Environment Variable Support: Add support for OPENCLAW_SERVER, OPENCLAW_IMAGE, OPENCLAW_TIMEOUT, OPENCLAW_TOKEN, OPENCLAW_PORT
  • Expanded Network Policy: Allow GitHub API access in addition to PyPI
  • Improved README: Add configuration tables, advanced usage section, and custom port documentation
  • Security Improvement: Truncate token in log output

Usage

# Using environment variables
export OPENCLAW_SERVER=http://localhost:8080
export OPENCLAW_IMAGE=ghcr.io/openclaw/openclaw:latest
export OPENCLAW_TIMEOUT=3600
export OPENCLAW_TOKEN=your-token
export OPENCLAW_PORT=18789

uv run python examples/openclaw/main.py

Testing

  • Code follows existing patterns
  • Backward compatible with existing usage

Related

  • Part of OpenClaw integration with OpenSandbox

… defaults

- Add environment variable support for server, image, timeout, token, port
- Expand network policy to allow GitHub API access
- Improve README with configuration tables and advanced usage
- Add custom gateway port documentation
- Add token truncation in log output for security
@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


OpenClaw Bot seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

- Change network_mode from Literal['host', 'bridge'] to str to allow
  user-defined network names
- Remove startup-time validation that blocked custom networks
- Update port-mapping logic to handle any non-host network mode
- Update endpoint resolution to work with user-defined networks

This enables OpenSandbox to work in Docker Compose setups with shared
user-defined networks (e.g., app-net), allowing sandbox containers to
communicate with other services like databases by hostname.
@Jah-yee Jah-yee requested a review from Generalwin as a code owner March 11, 2026 05:22
@Pangjiping
Copy link
Collaborator

Pangjiping commented Mar 12, 2026

Thanks for your submission. Please sign the CLA and you should revert the changes related to server docker network support in this PR, as there is a more complete implementation in #426 . This commit should only focus on the openclaw example.

@Pangjiping Pangjiping self-assigned this Mar 12, 2026
@Pangjiping Pangjiping added the documentation Improvements or additions to documentation label Mar 12, 2026
@jwx0925
Copy link
Collaborator

jwx0925 commented Mar 12, 2026

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6a9350ed79

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +381 to +383
network_mode: str = Field(
default="host",
description="Docker network mode for sandbox containers (host, bridge, ...).",
description="Docker network mode for sandbox containers (host, bridge, or user-defined network name).",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve case for user-defined Docker network names

By widening docker.network_mode to str here, configs can now carry user-defined network names, but DockerSandboxService.__init__ still applies .lower() before passing that value to Docker (server/src/services/docker.py, init path). That mutates the configured network identifier and can make sandbox startup fail against mixed-case custom networks (network not found), so the new custom-network support is not reliable. Normalize only known literals (host/bridge) and keep user-provided network names unchanged.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants